<template>
  <table border="1" cellpadding="10" cellspacing="0">
    <thead>
      <tr>
        <th v-for="item in column">{{ item.label }}</th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="row in data">
        <td v-for="(col, index) in column">
          {{
            column[index].$scopedSlots.default
              ? column[index].$scopedSlots.default(row)[0].text
              : row[col.prop]
          }}
        </td>
      </tr>
      <!-- 默认插槽：因为调用了所以才提示组件不存在 -->
      <slot></slot>
    </tbody>
  </table>
</template>

<script>
export default {
  data() {
    return {
      column: [
      ],
    };
  },
  mounted() {
  },
  props: {
    data: {
      type: Array,
      default: [],
    },
  },
};
</script>

<style></style>
